﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;

namespace YJKArch.EditFloor
{
	public class SearchLoopFilter : ISelectionFilter
	{
		public bool AllowElement(Element elem)
		{
			if (elem.GetType() == typeof(Wall))
			{
				return true;
			}
			if (elem.GetType() == typeof(Grid))
			{
				return true;
			}
			if (elem.GetType() == typeof(ReferencePlane))
			{
				return true;
			}
			if (elem.GetType() == typeof(FamilyInstance))
			{
				if (elem.Category == null)
				{
					return false;
				}
				if (null == elem.Category.Id)
				{
					return false;
				}
				if ((int)(elem as FamilyInstance).StructuralType == 1)
				{
					return true;
				}
			}
			return false;
		}

		public bool AllowReference(Reference reference, XYZ pos)
		{
			return false;
		}
	}
}
